using System.Web;
using System.Web.UI;
using PetShop.Web.Controls;
using PetShop.Web.Entities;

namespace PetShop.Web
{
    public partial class OrderShipping : Page
    {
        protected NavBar header;
        protected AddressUI shipAddr;
        protected StaticAddress staticAddressBilling;
        protected StaticAddress staticAddressShipping;

        private void InitializeComponent()
        {
            if (!IsPostBack)
            {
                enterShipAddress.Visible = true;
                confirmAddress.Visible = false;
            }
        }


        protected void ContinueClicked(object sender, ImageClickEventArgs e)
        {
            if (Page.IsValid)
            {
                AddressInfo shippingAddress = shipAddr.Address;
                HttpContext.Current.Session["SHIPPING_KEY"] = shippingAddress;
                var billingAddress = (AddressInfo) HttpContext.Current.Session["BILLING_KEY"];
                enterShipAddress.Visible = false;
                confirmAddress.Visible = true;
                staticAddressBilling.ShowAddress(billingAddress);
                staticAddressShipping.ShowAddress(shippingAddress);
            }
        }
    }
}